package com.xuecheng.content.model.dto;

import com.xuecheng.content.model.po.CourseCategory;
import lombok.Data;
import lombok.ToString;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

@Data
@ToString(callSuper = true) // 关键修复：让 toString() 包含父类字段
public class CourseCategoryTreeDto extends CourseCategory implements Serializable {
    List<CourseCategoryTreeDto> children;

//    public String toString() {
//        return "CourseCategoryTreeDto(super=" + super.toString() + ", children=" + this.children + ")";
//    }
    public void addChild(CourseCategoryTreeDto child) {
        if (this.children == null) {
            this.children = new ArrayList<>();
        }
        this.children.add(child);
    }
}
